package com.niit.mall.user.mapper;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.niit.mall.user.domain.po.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

/**
 * @BelongsProject: pardo_mall_backend
 * @BelongsPackage: com.niit.mall.admin.mappr
 * @Author: ChuXuan
 * @CreateTime: 2025-05-21  19:31
 * @Description: 用户Mapper
 * @Version: 1.0
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
	
	@Update("update tb_user set balance = balance - #{money} where id = #{id}")
	void updateBalance(@Param("id") Long id, @Param("money")Integer money);
	
	@Update("update tb_user set online_status = #{onlineStatus}, update_date = #{now} where id = #{id}")
	void updateOnlineStatus(@Param("id")Long id, @Param("onlineStatus")int onlineStatus, @Param("now") Date now);

}
